<template>
  <div class="History">
    <div v-for="(item,index) in datas" class="item">
      <div class="item-container">
        <span class="num">{{ item.lotteryDrawTime }}:{{ item.lotteryDrawNum + '期' }}</span>
        <span class="code" style="color: red">
             {{ item.lotteryDrawResult.split(' ')[0] }}
             {{ item.lotteryDrawResult.split(' ')[1] }}
             {{ item.lotteryDrawResult.split(' ')[2] }}
             {{ item.lotteryDrawResult.split(' ')[3] }}
             {{ item.lotteryDrawResult.split(' ')[4] }}
           </span>
        <span class="code" style="color: blue">
               {{ item.lotteryDrawResult.split(' ')[5] }}
               {{ item.lotteryDrawResult.split(' ')[6] }}
          </span>
      </div>
    </div>
  </div>
</template>
<script>

import datas from '@/data/demo'

export default {
  name: "History",
  data() {
    return {
      datas
    }
  },
  mounted() {
    this.initView();
  },
  methods: {
    initView() {
      let data = JSON.parse(JSON.stringify(datas));
      data.reverse();
      let blueData = data.map(item => {
        let dateStamp = new Date(item.lotteryDrawTime).getTime();
        let red0 = item.lotteryDrawResult.split(' ')[0];
        let red1 = item.lotteryDrawResult.split(' ')[1];
        let red2 = item.lotteryDrawResult.split(' ')[2];
        let red3 = item.lotteryDrawResult.split(' ')[3];
        let red4 = item.lotteryDrawResult.split(' ')[4];

        let blue0 = item.lotteryDrawResult.split(' ')[5];
        let blue1 = item.lotteryDrawResult.split(' ')[6];

        let array = [dateStamp, red0]
        return array
      });

      let datass = data.map(item => {
        let dateStamp = new Date(item.lotteryDrawTime).getTime();
        let red0 = item.lotteryDrawResult.split(' ')[0];
        let red1 = item.lotteryDrawResult.split(' ')[1];
        let red2 = item.lotteryDrawResult.split(' ')[2];
        let red3 = item.lotteryDrawResult.split(' ')[3];
        let red4 = item.lotteryDrawResult.split(' ')[4];

        let blue0 = item.lotteryDrawResult.split(' ')[5];
        let blue1 = item.lotteryDrawResult.split(' ')[6];

        return [red0,red1,red2,red3,red4,blue0,blue1]
      });
      console.log(datass)
    }
  }
}

</script>

<style lang="scss" scoped>
.History {
  .item {
    border-bottom: 1px solid #f2f2f2;
    line-height: 30px;

    .item-container {
      display: flex;
      align-items: center;
      justify-content: space-around;
      color: #8c8888;

      .code {
        margin: 0 10px;
      }
    }
  }
}
</style>
